#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    int cnt1=0,cnt2=0;
    for(int i=1;i<=n;i++)
    {
        int r;
        scanf("%d",&r);
        if(r==1)
        {
            cnt1++;
        }
        else
        {
            cnt2++;
        }
    }
    printf("%d\n",n-min(cnt1,cnt2));
    return 0;
}
